// (C) Copyright 2006 Marvell International Ltd.
// All Rights Reserved
//

#include "gcu_client.h"

GCUCmdBuf::GCUCmdBuf(UINT alloc_size)
{
    top = buf = new UINT32[alloc_size];
    if (top)
        buf_size = alloc_size;
}

GCUCmdBuf::~GCUCmdBuf()
{
    delete [] buf;
}

UINT32* GCUCmdBuf::alloc(UINT size)
{
    if (size > buf_size - get_size())
    {
        NKDbgPrintfW(TEXT("alloc failed!\r\n"));
        return 0;
    }

    UINT32* alloc_buf = top;
    top += size;

    return alloc_buf;
}

void GCUCmdBuf::reset()
{
    top = buf;
}

UINT32* GCUCmdBuf::get_buf()
{
    return buf;
}

UINT GCUCmdBuf::get_size()
{
    return top - buf;
}

